package no1;

import java.util.HashMap;
import java.util.Map;

class Solution {
    public int[] twoSum(int[] nums, int target) {
        Map<Integer,Integer> numLIst = new HashMap<>();
        int[] result = new int[2];
        for (int i = 0; i < nums.length; i++) {
            if (numLIst.containsKey(target-nums[i])){
                result[0]= numLIst.get(target-nums[i]);
                result[1]= i;
            }else {
                numLIst.put(nums[i],i);
            }
        }

        return result;
    }
}